<template>
  <a-modal :visible="open" :width="600" :title="formTitle" @cancel="onClose">
    <a-form-model ref="form" :label-col="{ span: 8 }" :wrapper-col="{ span: 14 }" :model="form" :rules="rules">
      <a-row>
        <a-col :span="24">
          <a-form-model-item  label="下载合同模板" prop="illustrate">
            <a  target="_blank" href="https://demomes.sdxhsn.com/profile/2024/07/26/%E5%85%B0%E5%89%91%E8%B4%A7%E7%89%A9%E6%89%98%E8%BF%90%E5%8D%8F%E8%AE%AE_20240726144034A001.pdf">下载</a>
          </a-form-model-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :span="24">
          <a-form-model-item label="上传盖章后合同"  prop="img">
            <base-upload v-model="form.img"></base-upload>
          </a-form-model-item>
        </a-col>
      </a-row>
    </a-form-model>
    <template slot="footer">
      <a-space>
        <a-button type="primary" :loading="submitLoading" @click="submitForm">
          保存
        </a-button>
        <a-button type="dashed" @click="cancel">
          取消
        </a-button>
      </a-space>
    </template>
  </a-modal>
</template>

<script>
import baseUpload from '@/components/imgUpload/index.vue'
import { detailsInsert, approvalFlow } from '@/api/demo'
export default {
  name: 'CreateForm',
  props: {
  },
  components: {
    baseUpload
  },
  data() {
    return {
      submitLoading: false,
      formTitle: '合同管理',
      id: null,
      vehicleId: null,
      processInstanceId: null,
      // 表单参数
      form: {
        id: null,
        img: undefined,
      },
      open: false,
      rules: {
      },
    }
  },
  filters: {
  },
  created() {
  },
  computed: {
  },
  watch: {
  },
  mounted() {
  },
  methods: {
    onClose() {
      this.open = false
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        img: undefined,
      }
    },
    /** 接单按钮操作 */
    handleAdd(row) {
      this.id = row.id
      this.vehicleId = row.vehicleId
      this.processInstanceId = row.processInstanceId
      this.reset()
      this.open = true
    },
    /** 提交按钮 */
    submitForm: function () {
      this.$refs.form.validate(valid => {
        if (valid) {
          this.submitLoading = true
          this.$message.success('保存成功')
          this.submitLoading = false
          this.cancel()
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>

</style>
